<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="https://apis.google.com/js/platform.js"></script>
    <meta name="google-signin-client_id" content="209911798351-70dmqc250u7cdbk1as4qh5gj20k4ev99.apps.googleusercontent.com">
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script type="text/javascript">
function onSignIn(googleUser) {
  // var profile = googleUser.getBasicProfile();
  // console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
  // console.log('Name: ' + profile.getName());
  // console.log('Image URL: ' + profile.getImageUrl());
  // console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
  var id_token = googleUser.getAuthResponse().id_token;
  var xhr = new XMLHttpRequest();
    xhr.open('POST', 'http://localhost:5000');
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xhr.onload = function() {
      console.log('Signed in as: ' + xhr.responseText);
    };
    xhr.send('idtoken=' + id_token);
}
</script>
</body>
</html>